package com.mitdy.sg.data.web.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import com.mitdy.sg.common.bean.JsonResult;
import com.mitdy.sg.data.crawler.SportGameCrawler;

@Controller
@RequestMapping("/")
public class MainController {

    @Autowired
    private SportGameCrawler sportGameCrawler;
    
    @RequestMapping("/index.html")
    public String index() {
        return "index";
    }
    
    @ResponseBody
    @RequestMapping(value = "/getBKData", method = RequestMethod.GET)
    public JsonResult getBKData(@RequestParam Integer index) {
        sportGameCrawler.start(index);
        return new JsonResult();
    }
    

}
